fixed update function to include delta