added basic error logging