Fixed failing unittest

Found out that the unittests have been failing for quite some time due to 011f190
The failing testcases have been corrected, and test runner have been updated to return exit code=1 on failure so that travis will see the failures in the future.