fixinf the problem with buffer