Fix for setting and returning of ref.
Merge pull request #27 from gstoeckel/master

Fix for setting and returning ref.