If else construction fix