MAME - mouse as lightgun keeps re-centering

Like the topic says, in MAME when I use a mouse for the lightgun, it keeps re-centering. Makes it hard to recalibrate it in the options when it keeps recentering itself to the middle of my screen. Anyone have a way to fix this?