Fixed crashes and I/O failures