modifications to make mail work