Buffer error fix