fixed consumer/producer switch bug