Revert "WARNING: this code brought to a crash!"

This reverts commit bd901341852f93ac1fb38b596c13f6aa069b6d4b.