check if returned value is an array (fixes NonType object is unsubscriptable)