When flushing buffer need to check if there is anything there