fix unhandled exception in message handling and add requirements.txt