move require statements to top of files
fix undefined ref in error
Merge branch 'rvagg-require-fix'