Fixing order of click issue