fixed compilation on Linux; fixed a few crashes
minor fixes