fixing bug in add resource