A new attempt instead of sign bit checking since it caused errors.