Bug fixes and polishing