Fixed JavaScript error, closes #262