Rotating creates Z-offset

Hi everyone,
I’m probably facing some rounding error here while rotating an object, I don’t know, hope someone can see the flaw in my code:
In my little side scroller I’m turning my little submarine left and right, 0 and 180 degrees on Y axis and then apply a directional force to move it forward (and up to prevent sinking). problem is that after some time I end up with a z-offset, (despite freezing z position as well as y+z rotation!) causing the boat to leave the level contraints.

	// Submarine controls
		if (Input.GetAxis('Horizontal') > 0) //right key: set direction and add forces
		{
			boatDirection = 0;
			rigidbody.AddForce(fwForce*Time.timeScale,0,0);
			rigidbody.AddForce(0,upForce*Time.timeScale,0);
		}
		
		if (Input.GetAxis('Horizontal') < 0) //left key: set direction and add forces
		{
			boatDirection = -180;
			rigidbody.AddForce(-fwForce*Time.timeScale,0,0);
			rigidbody.AddForce(0,upForce*Time.timeScale,0);
		}
		
	// rotate submarine - Dampen towards the target rotation
		var target = Quaternion.Euler (0,boatDirection,0);    
	    transform.rotation = Quaternion.Slerp(transform.rotation, target,Time.deltaTime * turnSpeed);

can anybody tell me why freezing isn’t preventing the z-offset from happening?

cheers

could different pivots of partent object and mesh be a reason for the z-offset?

or is it possible that transform.rotation doesn’t transform to the exact values of 0 or -180?