Fix function in reaper_client, add test cases