fixed a bug where the same resource could exist twice