added a panic handler