Bug fixes on dev branch