fix a bug with empty Array