Some preparations for  error messages and bug fixes