Made it a bit more fault-safe.