fixed some buffer isses