Reordering the checks

Change-Id: I7d901e3ce2961924b661f2e7fac96e52301b50e4