Empty array bug fixed