Bug fixes to get the package a little more stable