fix issue with empty array