Fixed a bug in tenant management