Check if total is undefined prior using the pristine total. Fixes #30