a lot of semantic fixes