fixing two bugs