more tests and fix bug with phase creation