Added put method, fixed type checking