Removed illegal characters, added trap