Fix a few little bugs.. intoroduce more fault tolerance