changed cost and added run_error