Merge smartp

Fixes to:

* drag and drop
* Segfault under some conditions.
* Fixed browsefiles use requirejs.