[code] various fixes here and there