Fixes some errors in texture cache implementation