fixed some more critical bugs in core