Added some extra debugging to track problems with