Fixed bug in models/core.php