Fixed bugs in the Core