fixed issue with public js executing twice