fix paths and move application loading to environment