Some minor bug-fixes