fixed issue with error raising and messages