Fix runtime panics