fixed various pesky bugs