formal changes; error messages improved