fixed bug in trap.c (lab6)