Various fixes according to puls’s suggestions.