Minor fixes

Some minor changes, which solve exceptions i encounter.