fixed server bug and cacluate profit based on profit