added error logging functionality, fixed customer load by code in invoice