add unit tests
fix incorrect including for some conditions