Clamping turret rotation not working properly

Code:

local direction = CFrame.new(turret.Gun.Position, mous.Hit.p)
local x,y,z = direction:ToEulerAnglesXYZ()
x = math.clamp(x,math.rad(-90),math.rad(90))
y = 0
z = math.clamp(z,math.rad(-90),math.rad(90))
direction = CFrame.Angles(x,y,z)

Result:

Not that great with cframe stuffs, help is appreciated.