Fixed possible deadlock with port mapping