fixed the order the conditions executed

order of condition is fixed