error handling
corrected logging