Patches for Several bugfixes, enhancements and code cleanups [sf#1143849] [#416]