Fixed error with buffer