minor fixes to functions