changed ternary operator to if block due to swig support