add trap and guard