Fix to return buffer output properly.