add some debug logging to try and figure out the problem