added buffer size bug