How I fixed a bug using javascript `call` method