hide function
fixed error message
issue #1098: added better error checking