Bug fixes and changes