Add some more debug code and maybe catch some more exceptions