fix building detection