Linux port: fixed few problems