UnitTests + fixes