Fixed some minor code mistakes