Fixing update function