Fixed isssue with empty array