added logging for 500-errors