Bug fixes to earned_on and other changes