Fixed bug in db_input using the wrong id to look up datamap