Fixed some edge cases in the put function.