[PLAT-6858] Added unit tests, fixed bugs