Fix some unit testing problems
Unit tests fixes

Unit tests passed on CentOS 6.5 with this fixes