Debug flag introduced
Tests fixed