moved compatibility code in a separate file