added error handling for unknown characters