follow gitwrap ref_stuff branch

This PR is following the current development in GitWrap and fixes stuff. Should be merged as soon as GitWrap stuff is ready.