This should fix the casting errors