better error checking for DBUS_BUS_SESSION
fix constness
remove dead code