Fixed C extension sandbox behavior

fixes #1254