Add cups fix from upstream
Merge pull request #800 from pyhalov/cups

Add cups fix from upstream