Applying a more elaborate fix for the hang