Some bugs fixed (generally)