Bugfix/fix trap

Fix the incorrect "trap" usage.