Major bugfixes surrounding panic handling