fixing js code