Fix panic on certain broken input