Small tweaks and bug fixes