added option for logErrors