fixed a type error in output_to_db