fixed schema creation and added test for it
Merge origin/master