more logging and checking