Change error logic, fix api call to pass $core