Fix crash on unknown buffers, add signal handlers to allow for termination and client disconnection and clean up error checking and reporting.