Fix potential server crashes