fix a bug about template context saving
delete attachment from session