eliminate deprecation warning and improve error messages