Some logic changes in put(), remove()