some slight logic/syntax fixes for #336