various fixes/improvements