Changes to make fp work with nano-js

WARNING: The last commit hard-codes some quick fixes