Minor fix on autoend not working correctly