Minnor bug fixes