Some fixes in navigate.js

- Call navigate.to's callback only after the content is rendered.
- Add alerts.
- Renames.