profit calculation bug fixed