OK it should work now. Changed the '<' to '<=' when checking buffer size