Cast to int properly