Modified error logging