improve traps for unexpected end