better error logging
write HTML using binmode utf8