backported if statements from hydro