Fixing resource bug