Make related widget work

* fix javascript error on page load* fix template and related-object service response to use  the correct structure