fixed js function placement