Merge pull request #1015 from dorkster/fixes

Fix crash in RenderDevice cache lookup