Fix casting of integers