adding the code fixes from @acatl