Fix for request generation and adding a unit test