Fix some warnings
Use more optimized implementation for 16/32