this seems to be working better, try passing the result into an APInt constructor