improvements on errors and messages