workaround for golang bug 5718, minor changes