Several minor fixes

Commit messages speak for themselves decently, let me know if you have questions. The demo actually didn't work because the problem fixed in 8b58632.