Fixed issues with building manager algorithm