fix buffer breakage in major mode change
add elpa support