minor fixes to a bug