fix two bugs in last commit for #402