res fix
Added unit tests