fixed compile errors
adding unit test