Bug fix: filter out null instances before returning the list