added factories and new test
fixed possible log error