Bug fix in the scaled algorithm