Added some code for locking (PD)building(s)