Fixed some name checking bugs