Fix javascript handling, other minor fixes