remove empty elements in an array