Minor improvements, including fixes, performance and safety