Fixing null exceptions on trap checking.