Make getObject const. Remove a const_cast.