Fix error of enum cast