Small tweaks

Some bug fixes and changes