miscellaneous enhancement and bug fix