How to stabilize voltage when controlling 12V motor
You need to do a couple of things here. First, you need to add diodes on each side of the motor and connect them to power terminals like this image from here (I recommend not to use the MOSFET internal diodes):

Also, add the capacitor like the image near the power terminal. The Zener is also a good idea. If the speed of Zener is not good enough, use a faster diode like TVS diodes (I doubt you be needing that).
NOTE: in the circuit in the picture, the protecting diodes (D1, D2, D3, D4) are connected directly to the power terminal. You are using a resistor to detect current consumption; so notice that the diode must be connected to the ground, not the resistor.