some fixes after a messy merge