Added a safe callback decorator for async

Planning to async all middleware so need safe callbacks
Updated all middleware to work async

Utilized the earlier safe callback module and translated all
middleware to work async.
Also picked out a few bugs from the server and main middleware modules.