Bug fixes for Envelope class