Finish testing. Fix 2 bugs in core