Clear output buffer only if it's not empty