fix 2 important bugs