Minor bugfixes and changes