Fixing bug where exceptions dont pass through properly