bugs fixed, error messages added