add debug output
improve session and db config handling