Made compilable with g++ 4.8.2 and fixed unit tests