return nil instead of empty array on error