Minor improvements and bug fixes