fixed strange behavior when order of writable channels is different, added test