some fixes in js identified by CloudPebble