error logging added