better error msgs, bug fix