RES bug fix provided by 7oby.
Merge pull request #8 from dsokol/res-bug

RES bug fix provided by 7oby.