Fix implementation of retrieveObject method