Fix function implementation for backward compatibility