Bugfixes, and better cube mesh generator