Small update in code for prevent JS errors