Fixes for devise upgrade