fixed bug in condition generation and more