fixing long cast to int