Fix modify adding optional keys. Closes #187