fixed log to database