The main crank sprocket on M5x motors tends to wear out over time with the chain removing material from the teeth of the sprocket which can cause issues with chain retention.
Replace your worn original sprocket with this direct replacement from INA and avoid potential chain issues.