fixes some of #4, default to 0 instead of nil