some fixes from testing Javascript mode