Solved some code errors