fix a whole bunch of threading, application shutdown and RMI issues as well as some other minor bugs