Bug when using two displays

I think the image is self-explanatory. Whenever I am using two displays, when I drag and drop a window to a different space, this window appears in the second display and vice-versa.