replaced manually new/delete by AutoBuffer