fixes #1210 and some other small issues