bugfixes for training