Fix for objective function