Added the errorlog and debugged