Fixed bug in converting binary buffer