Fix wrong cast