Some bugfixes and script updates