Fixes error logging