Fixed unittests
Merged with master