Some bugfixes and little changes