fix a few final bugs (final commit)