Fix wrong casting