Fixed empty array bug