Fixed some problems and warnings.