fixed trap mem check, added some extra tests