fix exceptions not getting handled