Minor improvements, bug checkings