fixed DB update function