fix test errors and enhance the manager