Fix crash when creating project

Fixes #322
Add test
Merge pull request #328 from korczis/fix-create-project

Fix crash when creating project