Fix for registering MELPA

This code taken from #137.