Revert "Many fixes"

This reverts commit 0a727aca5b1326963af474189d4707a8b065b228.