minor and major bug fixes