fixed upload and added debug logging to dbhandler