fix strict errors. make js work on front- and back-end