Some corrections. Still not solved why it fails after a while