Fix wrong type cast