Fix/resource association search

Please have a look to the commit comments for detailed explanations.