Fix for http://mantis.brewpi.com/view.php?id=6

Details of the changes are documented in http://mantis.brewpi.com/view.php?id=6