anaylzer fixes, some unit tests for it