Added handling for sync ref when it is 0, add caching for lookup