fix a bug when resources exceed 1 million