Fix empty array problem