fixed overflow error on some systems