JavaScript fixes