fix missing return
fix bad merge
keep tmp array alive for swig