Reorder checks to avoid redundant actions
Merge pull request #474 from Dmitry-Me/reorderChecks

Reorder checks to avoid redundant actions