Minor fixes

- fixed remove_obj method
- added count_total_refs method
- added toString method on queries