Fixed minor code errors