fixed most of errors at trap