made a few changes to increase compatibility