made getattr and fgetattr a bit more robust