Fixed compilation errors
Added version detection

before determining custom attributes