replaced runtimeerror with exit(1)