Add conditional statement to fix broken tests