fixed some compatibility problems.