PLA-1059 Unit test + fixed bug