added more error logging