Some small bugfixes for reliability