Replace undefined with panic