Fixed compilation problems on ubuntu 12.10. Mostly unchecked return values.