further fix of Javascript for program preview feature