Merge bugfix from jander branch into master