Return of array not working