Swapped these checks to fix some issues