Remove duplicate code that gave problem with a resource specified twice