Fix random bugs