added condition for res of 1 for setBG