return value added, error messages are printed out