Fixed the deadlock situation in multi-job actions and added more unit tests.