use __typeof__ insted of typeof to hopefull fix g++ 4.8
fixed map image case
Merge commit 'a02b68035118804d08bab7257e383cf0dece2154' into host-as-flags.2