Fixed error checks in helpers.