better error handling with hacky regex parser