Fixes bad charref handling

This PR fixes #6 
Look at commits for details ;)