Write error to log instead of stdout
Make indexing scripts more flexible.