fixed two bugs (in one commit)