Add some debugging code to try and work out #19