Correcting some majors bugs