fixed two bugs.