fixed empty array problem