buffer size bug fixed