made settings into a function. empty stats.xml gives an informative message instead of exception.