merged a few fixes