[BUG] Misaligned building preview

I made a custom building template, and while moving cursor around, it’s showing correct positions of windows. When I click on ground, windows misalign.
See screenshots:

and…

Also on a semi-related note: I was unable to put a roof on a first floor
1- made 6x6 floor
2- walls around it
3- made second floor on top of walls
4- walls on top of that
5- tried to put roof to top it off, but when I clicked, the ‘ghost roof’ disappeared.
F5 didn’t help, loading a savegame didn’t help, only ‘destroy’ console command helped (yes the ‘ghost’ building couldn’t be removed via normal, building tools, means.