segfault corrected ... but in non-portable manner.