some bugfixes and style tweaks