Attempting to fix #4166

I couldn't find a way to access `numPages` from `WorkerTransport` directly. This is the temporary fix made on similar lines to #3611