updated clear_buffer