playing with ref for error msg