reverting previous commit since it resulted in segfauls