tuning

found a few bugs that needed fixing.