fixes to allow original non-rails version to work again