fixed some of the minitest tests and refactored the code of the am_manager to pass those tests