See issue #59

Fixed 
    if (error)
to
    if (!error)