Fix synchronous background job and add simple unit test