fixed yet more bugs