more error checking in parsing