added some debug lines to pinpoint where it crashes