Removed buf <=0 errors