fixed some parsing errors, added error messages