fixed some notices and warnings.