Changes to fix bugs