Fixed an overflowing problem when converting double to decimal