fix payment calculations