Buffer overflow fix