fix signed integer conversion