Clean up panics.

Only panic in debug mode.