Bug fixes and small additions