added error check in sendAction