Switched from printing errors to stderr to log
Added assertion to test