A couple of bugs in put_object

put_object was failing on empty (0 byte) contents and on when given file objects.