various bug fixes (see diff), beginning to fix Toay