Fcr fix iqp illegal cast to poly

add brackets to the if