integration test corrected
error handling added to be more verbose