Fixed locks, added core-local storage (in gs segment), fixed scheduler init.