various fixes of code