Fix various bugs
Merge branch 'patch' of http://github.com/GraniteTeam/Granite into patch