fix three problems