merge in some fixes i found in a sandbox