fixed possible overflow