major bug fix attempt 3