Fix bugs brought about by last change