Fix integer primitive unification bugs and expand to encompass bigints

This includes #307 and #308.