bug fixes in decimal implementation