enhance error message with failure message
fix error unittests and resolve unitialized value warnings