Better logging, fix some quoting problems