Fix with writing into DB.