Warning fixes and additional error logging