Added tests to the check_euid method

  Since aply needs to check the EUID value, tests around this function were
  added and for better handling of problems, exception is thrown rather than
  program exit.