get rid of if/else expressions to preserved python2.4 compatibility