fixed updating for database