output and various fixes