added error handling in hw_link