replaced reflection with simple API level check