remove a bunch of warnings, a few bug fixes