Fix error with profit calculation