Fix #22, avoid infinite recursion for self referencing resources