issue #803 add ref. types cost & some fixes