bugfixes and demo 2 tested