Fix cache issue with escaping single quote. Also ensure we have no redundant entries in dependencies table.