Changing cast from intValue to integerValue per @aerych's suggestion.