Add checking for empty algorithm argument