Two minor fixes

Avoid performance problems on 9600M, and cast to avoid some warnings.