added swap check