Don't use deprecated function.
Fix signed/unsigned warnings.