Fix for switch_buffer