Fix illegal operation bug