Fix JS initialization; improve handling of enter key.