mean fixed + a couple other small bugs