Fixed an infinite gems bug