fix test errors, fix rest.js wrong switch on construct