Bug fix - long to int cast problem