fixed error on empty array passed in