Fixed issue with empty arrays