fixed many issues with moving to middleman