fix error handling in null arr case