fixed some os bugs.