bug fix and add javascript testing