Fixed JS wrapper function termination